Skip to content
This repository was archived by the owner on Apr 2, 2026. It is now read-only.

Change the visibility of InputRef::full_slice() from pub(crate) to public#960

Merged
zesterer merged 2 commits into
zesterer:mainfrom
cnglen:public_fullslice
Mar 8, 2026
Merged

Change the visibility of InputRef::full_slice() from pub(crate) to public#960
zesterer merged 2 commits into
zesterer:mainfrom
cnglen:public_fullslice

Conversation

@cnglen

@cnglen cnglen commented Feb 13, 2026

Copy link
Copy Markdown
Contributor

Change the visibility of InputRef::full_slice() from pub(crate) to pub, enabling access to the complete raw input slice from within the imperative-style custom() method

…b, enabling access to the complete raw input slice from within the imperative-style custom() method
Comment thread src/input.rs Outdated

/// Get full slice of raw input.
///
/// Note we have to make sure our index of full slice land in the correct boundary of utf8 character if using utf8 input.

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure that I understand what this note is trying to say, could you clarify?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For example, if the slice of raw input is &str,

  let s: &str = "你好"; // for utf8 character, non ascii character
  // OK
  let a = &s[0..3];
  println!("{}", a);

  // panic since 1 is not the right byte boundary of utf8 char <--------------
  let a = &s[1..3];
  println!("{}", a);

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no particular notion of 'boundaries' built into SliceInput, that's purely a function of &str. I don't think this is worth mentioning in this doc comment.

I am not sure what 'our index of full slice' refers to in the comment either: the method has no parameters?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are right. I have removed the unclear and unnecessary lines in the comments.

@zesterer

zesterer commented Mar 8, 2026

Copy link
Copy Markdown
Owner

Thanks for the PR!

@zesterer
zesterer merged commit 1e2b51a into zesterer:main Mar 8, 2026
4 checks passed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants